import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:s_mankey/config/resource_mananger.dart';
import 'package:s_mankey/ui/widget/show_big_img.dart';

class EnterpriseDetail extends StatefulWidget {

  final arguments;

  EnterpriseDetail({this.arguments});

  @override
  _EnterpriseDetailState createState() {
    return _EnterpriseDetailState();
  }
}

class _EnterpriseDetailState extends State<EnterpriseDetail> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  List<String> imgList = [
    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1483214666,3261663512&fm=26&gp=0.jpg',
    'https://tse3-mm.cn.bing.net/th/id/OIP.ENFc04HFbPQ9H3jmjVEq9gHaLG?w=200&h=300&c=7&o=5&pid=1.7',
    'https://tse3-mm.cn.bing.net/th/id/OIP.2SfnwMawwtDJgHBFItmv9wHaE5?w=278&h=183&c=7&o=5&pid=1.7',
    'https://tse4-mm.cn.bing.net/th/id/OIP.wsGYCb8v5jlKdrLn2ewVbQHaEK?w=290&h=180&c=7&o=5&pid=1.7',
    'https://tse2-mm.cn.bing.net/th/id/OIP.foO_O8mDfOAGzNHcLdgwegHaE8?w=244&h=180&c=7&o=5&pid=1.7',
  ];

  @override
  Widget build(BuildContext context) {
    int indicator =  (imgList.length / 3).toInt();
    return Scaffold(appBar: AppBar(title: Text('企业详情'),
    elevation: 1,),
      body:
      Column(children: <Widget>[
//        Row(
//          crossAxisAlignment: CrossAxisAlignment.start,
//          children: [
//            ClipOval(
//              child: Image.network(
//                widget.datas[index]['company_logo'],
//                height: 35,
//                width: 35,
//                fit: BoxFit.cover,
//              ),
//            ),
//            Expanded(
//              child: Padding(
//                padding: const EdgeInsets.only(left: 10),
//                child: Column(
//                  crossAxisAlignment: CrossAxisAlignment.start,
//                  children: [
//                    Text(
//                      widget.datas[index]['company_title'],
//                      style: TextStyle(
//                          color: Color(0xff2b2b2b),
//                          fontSize: AppFontSize.Size14),
//                    ),
//                    Text(
//                      widget.datas[index]['area_name'],
//                      style: TextStyle(
//                          color: Color(0xff939393),
//                          fontSize: AppFontSize.Size12),
//                    ),
//                  ],
//                ),
//              ),
//            ),
//
//          ],
//        ),
//      中
        ///内容
//        Padding(
//          padding: const EdgeInsets.fromLTRB(
//              0, AppPadding.Padding10, 0, 0),
//          child: Text(
//            widget.datas[index]['company_brief'],
//            style: TextStyle(
//                fontSize: AppFontSize.Size14, color: Color(0xff71777e)),
//          ),
//        ),

        ///查看信息
        Container(
          width: 220,
          alignment: Alignment(0,0),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
            GestureDetector(onTap: (){
              print('点了联络方式');
            },child: Column(children: <Widget>[
              Icon(Icons.phone,size: AppFontSize.Size28,color: Color(0xff506dff)),
              Container(
                padding: EdgeInsets.all(8),
                margin: EdgeInsets.only(top: 10),
                decoration: BoxDecoration(color: Color(0xffebeeff), borderRadius: BorderRadius.circular(5)),
                  child: Text('查看联络方式',style: TextStyle(color: Color(0xff506dff)),)),
            ],),),

              GestureDetector(onTap: (){
                print('点了联络方式');
              },child: Column(children: <Widget>[
                Icon(Icons.monetization_on,size: AppFontSize.Size28,color: Color(0xff506dff)),
                Container(
                    padding: EdgeInsets.all(8),
                    margin: EdgeInsets.only(top: 10),
                    decoration: BoxDecoration(color: Color(0xffebeeff), borderRadius: BorderRadius.circular(5)),
                    child: Text('查看优惠方式',style: TextStyle(color: Color(0xff506dff)),)),
              ],),),
          ],),
        ),

        ///图片
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
          IntrinsicWidth(child: Container(
            margin: EdgeInsets.fromLTRB(5, 0, 0, 5),
            padding: EdgeInsets.all(2),
            decoration: BoxDecoration(color:Color(0xfff5f7f8), borderRadius: BorderRadius.circular(2)),
            child: Row(children: <Widget>[
              Icon(Icons.photo,size: AppFontSize.Size16,color: Color(0xffafc3e3 ),),
              Text('图片',style: TextStyle(color: Color(0xffafc3e3 )),)
            ],),
          ),),


          Container(
            height: 100,
//            color: Colors.red,
            child: Swiper(
//              physics: NeverScrollableScrollPhysics(),
              index: 1,
//              itemWidth: 20,
              viewportFraction: 0.33,
            itemCount:  imgList.length,
            autoplayDelay: 3000,
            autoplay: false,// 自动滚动
              loop: false, //无限轮播
            pagination: new SwiperPagination(
              alignment: Alignment.bottomCenter,
                margin: EdgeInsets.only(top: 30),
                builder:
                DotSwiperPaginationBuilder(
                  color: Colors.black54,
                  activeColor: Colors.white,
                  size: 5
                )
            ),
//                  loop: true,
            itemBuilder: (BuildContext context, int index) {
              return Padding(
                padding: const EdgeInsets.fromLTRB(5,0,5,0),
                child: new Image.network(
                  imgList[index],
                  fit: BoxFit.cover,
                ),
              );
            },
            onTap: (index){
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (context) {
                return ImageShowServerWidget(
                  initialIndex: index,
                  photoList: imgList,
                );
              }));
            },
          ),),

        ],),

        ///分割线
        Container(color: Color(0xfff5f7f8), height: 2, margin: EdgeInsets.only(top: 10),),

        ///经营范围
        Container(
          margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
          decoration: BoxDecoration(color: Colors.red ,borderRadius: BorderRadius.circular(5)),
          child: Column(children: [
            Text('经营范围'),
            Container(color: Color(0xfff5f7f8), height: 2, margin: EdgeInsets.only(top: 10),),
            Text('中港法律资询'),
          ],),
        ),

      ],),
    );
  }
}